package com.woniu.cms.psm.core.controller;


import com.woniu.cms.psm.core.entity.PmPlan;
import com.woniu.cms.psm.core.entity.PmPrecontrol;
import com.woniu.cms.psm.core.service.IPmPlanService;
import com.woniu.cms.psm.core.service.IPmPrecontrolService;
import com.woniu.common.api.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lilili
 * @since 2022-09-16
 */
@RestController
@RequestMapping("/pm-precontrol")
@Api(tags = "项目预控控制器")
public class PmPrecontrolController {
    @Resource
    private IPmPrecontrolService precontrolService;

    @ApiOperation("提交预控费用")
    @PostMapping("/commit")
    public Result<Object> commit(@RequestBody PmPrecontrol precontrol){
        precontrol.setId(null);
        boolean commit = precontrolService.save(precontrol);
        return Result.common(commit);

    }

    @ApiOperation("展示所有预控表单")
    @GetMapping("/all")
    public Result<List<PmPrecontrol>> all(){
        List<PmPrecontrol> list = precontrolService.list();
        return Result.common(list);
    }
}

